#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "afxdtctl.h"
//#include "../Hook/Hook.h"


// CAnalyzeDlg dialog

class CAnalyzeDlg : public CDialog
{
	DECLARE_DYNAMIC(CAnalyzeDlg)

public:
	CAnalyzeDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CAnalyzeDlg();

// Dialog Data
	enum { IDD = IDD_ANALYZE };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedBtnBrowse();
private:
	Record *m_pRecords;
	LogHeader m_logHeader;
	TCHAR m_strApps[APP_COUNT][MAX_PATH];
	long m_lRecCount;
	std::vector<CAppNode> m_vAppNodes;
	CEdit m_ePath;
	CTreeCtrl m_treeApps;
public:
	afx_msg void OnTvnSelchangedTreeApps(NMHDR *pNMHDR, LRESULT *pResult);
private:
	CEdit m_editDisplay;

public:
	void SetRecPath(LPTSTR path) { m_strLogPath = path; }

protected:
	virtual BOOL OnInitDialog();

private:
	void Display(CAppNode *pNode);
	CAppNode SumSubNodes(HTREEITEM hItem);
	void EnableTimeRange(bool enable = true);
	void Clear();
	void ProcessData();

public:
	afx_msg void OnEnChangeEditPath();
private:
	LPTSTR m_strLogPath;		// used only when dialog displayed the first time.
	CStatic m_staticInfo;
public:
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
private:
	CFont m_fontInfo;
	bool m_bWrongFile;
	CDateTimeCtrl m_dateFrom;
	CDateTimeCtrl m_dateTo;
public:
	afx_msg void OnBnClickedAll();
	afx_msg void OnBnClickedToday();
private:
	long m_lFrom;
	long m_lTo;
public:
	afx_msg void OnDtnDatetimechangeDatetimepickerFrom(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnDtnDatetimechangeDatetimepickerTo(NMHDR *pNMHDR, LRESULT *pResult);
};
